﻿@using System.Xml.Linq
@model XElement

@{
    ViewBag.Title = "Servicio WCF";
}

<h1>Servicio Windows Communication Foundation</h1>
<div>
@using (Html.BeginForm("ServicioWCF","Home",new {id = ""} ,FormMethod.Get))
{
    <div class="editor-field">
        @Html.TextBox("busqueda", "" , new { @placeholder = "Buscar..."}) 
    </div>
    <input type="hidden" value = 10 name="cant" />
    <input type="submit" value=Buscar />
}
</div>
<div>
    @foreach (XElement e in Model.Descendants("Evento"))
    {
        @Html.ActionLink(@e.Descendants("Nombre").First().Value, "ServicioWCF", new { cant = 10, busqueda = @ViewBag.Busqueda, id = (int)@e.Attribute("id") }, new { @class = "link-p", title = "Fecha: "+@e.Descendants("Fecha").First().Value })<br />
        if (ViewBag.Detalle != null && ViewBag.id == (int)@e.Attribute("id"))
        {
            <div class="evento-detalle">
                @{
                    XElement det = (XElement)@ViewBag.Detalle;
                }
               @det.Descendants("Nombre").First().Value - @det.Descendants("Fecha").First().Value: @det.Descendants("Descripcion").First().Value
            </div>
        }
    }
</div>
